import request from '@/utils/request'
// 申请事项 API接口
const std_matterApi = {
  list: '/std_matter/list',
  save: '/std_matter/save',
  view: '/std_matter/view',
  del: '/std_matter/delete',
  dels: '/std_matter/batchDel',
  output: '/std_matter/output',
  exportExcelTemplate: '/std_matter/exportExcelTemplate',
  importExcel: '/std_matter/importExcel',
  findByBizType: '/std_matter/findByBizType',
  getMatterByFormid: '/std_matter/getMatterByFormid',
  findProcessNodeList: '/std_matter/findProcessNodeList',
  findtMatteByApplyid: '/std_matter/findtMatteByApplyid'
}

    /**
     * 根据申请表id查询关联事项
     * @param applyid
     * @return
     */
 export function findtMatteByApplyid(applyid) {
  return request({
    url: std_matterApi.findtMatteByApplyid,
    method: 'post',
    params: {
      applyid
    }
  })
}

/**
 * 根据事项id，查询流程模型节点
 * @param matid
 * @return
 */
export function findProcessNodeList(applyid) {
  return request({
    url: std_matterApi.findProcessNodeList,
    method: 'post',
    params: {
      applyid
    }
  })
}

/**
 * 根据表单定义id查询事项
 * @param formid
 * @return
 */
export function getMatterByFormid(formid) {
  return request({
    url: std_matterApi.getMatterByFormid,
    method: 'post',
    params: {
      formid
    }
  })
}

/**
 * 导入申请事项Excel
 */
export function importExcel(data) {
  var body = new FormData()
  body.append("file", data);
  return request({
    url: std_matterApi.importExcel,
    headers: {
      "Content-Type": "multipart/form-data"
    },
    method: 'post',
    data: body
  })
}

/**
 * 导出申请事项Excel模板
 */
export function exportExcelTemplate() {
  return request({
    url: std_matterApi.exportExcelTemplate,
    method: 'post',
    responseType: 'blob'
  })
}

/**
 * 导出申请事项
 */
export function output(data) {
  return request({
    url: std_matterApi.output,
    method: 'post',
    data: data,
    responseType: 'blob'
  })
}
/**
 * 批量删除申请事项
 * @param {*} ids
 */
export function delStd_matters(ids) {
  return request({
    url: std_matterApi.dels,
    method: 'post',
    params: {
      ids
    }
  })
}
/**
 * 删除申请事项
 * @param {*} id
 */
export function delStd_matter(id) {
  return request({
    url: std_matterApi.del,
    method: 'post',
    params: {
      id
    }
  })
}
/**
 * 查看、编辑申请事项
 * @param {*} id
 */
export function viewStd_matter(id) {
  return request({
    url: std_matterApi.view,
    method: 'get',
    params: {
      id
    }
  })
}
/**
 * 保存申请事项
 * @param {*} body
 */
export function saveStd_matter(body) {
  return request({
    url: std_matterApi.save,
    method: 'post',
    data: body
  })
}
/**
 * 查询申请事项列表
 * @param {*} body
 */
export function queryStd_matterList(body) {
  return request({
    url: std_matterApi.list,
    method: 'post',
    data: body
  })
}

/**
 *根据业务类型查询事项
 * @param {*} parameter
 * @returns
 */
export function findByBizType(parameter) {
  return request({
    url: std_matterApi.findByBizType,
    method: 'post',
    params: parameter
  })
}